package lyx.utils.log
{
	public class Logger
	{
		static private var _instance:Logger;
		
		public function Logger()
		{
		}
		
		static public function getInstance():Logger
		{
			if(_instance==null)
			{
				_instance = new Logger();
			}
			return _instance;
		}
		
		public function debug(message:String,... rest):void
		{
			if (message == null) return;
        	var len:uint = rest.length;
	       	var args:Array;
	        if (len == 1 && rest[0] is Array)
	        {
	            args = rest[0] as Array;
	            len = args.length;
	        }
	        else
	        {
	            args = rest;
	        }
	        
	        for (var i:int = 0; i < len; i++)
	        {
	            message = message.replace(new RegExp("\\{"+i+"\\}", "g"), args[i]);
	        }
	        
			trace(message);
		}

	}
}